<template>
	<view>
		<view class="contract-number">合同编号：{{contractId}}</view>
		<view class="title">项目</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					项目
				</view><!-- contractWorkAddress --><!-- "请选择工作地点" -->
				<view class="intext-in">
					<picker mode="selector" :range="workeAdderss" @change="setworkeAdderss($event)">
						<view style="color: #808080;">{{contractProjectName}}</view>
					</picker>
				</view>
			</view>
		</view>
		<view class="title">用人单位信息</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					用人单位名称
				</view>
				<view class="intext-in">
					<picker mode="selector"  :range="subcontractingName" @change="setsubcontracting($event)">
						<view style="color: #808080;">{{unitName}}</view>
					</picker>
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					统一社会信用代码
				</view>
				<view class="intext-in">
					<input type="text"  v-model="unitCreditCode" placeholder="统一社会信用代码">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					法定代表人/负责人
				</view>
				<view class="intext-in">
					<input type="text" :disabled="true" v-model="unitOwnPerson" placeholder="法定代表人人名">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					电话
				</view>
				<view class="intext-in">
					<input type="text" :disabled="true" v-model="unitOwnPhone" placeholder="电话">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					住所
				</view>
				<view class="intext-in">
					<input type="text"  v-model="unitAddress" placeholder="住所">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					联系地址
				</view>
				<!-- 字段效验 -->
				<view class="intext-in"><!-- unitContactAddress -->
					<input type="text"  v-model="unitAddress" placeholder="联系地址">
				</view>
			</view>
		</view>
		<view class="title">劳动者信息</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					劳动者姓名
				</view>
				<view class="intext-in">
					<input type="text" :disabled="true" v-model="workerName" placeholder="请填写劳动者姓名">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					性别
				</view>
				<view class="intext-in">
					<radio-group name=""  @change="setsex($event)" class="bianxin">
						<label>
							<radio :value="1" :disabled="workerSex==0" :checked="workerSex==1" color="#2f67ff"/><text>男</text>
						</label>
						<label>
							<radio :value="0" :disabled="workerSex==1" :checked="workerSex==0" color="#2f67ff"/><text>女</text>
						</label>
					</radio-group>
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					身份证号码
				</view>
				<view class="intext-in">
					<input type="text" :disabled="true" v-model="workerIdentityCard" placeholder="请填写劳动者身份证号码">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					电话号码
				</view>
				<view class="intext-in">
					<input type="text" :disabled="iscountNumber(workerPhone)" @blur="isPhone(workerPhone)"
           v-model="workerPhone" placeholder="请填写劳动者电话号码">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					联系地址
				</view>
				<view class="intext-in">
					<input type="text" :disabled="addressIsNull" v-model="workerContactAddress" placeholder="请填写劳动者联系地址">
				</view>
			</view>
			<view class="in-text" style="border: none;">
				<view class="itext-word" style="font-size: 16px; ">
					紧急联系信息
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					姓名
				</view>
				<view class="intext-in">
					<input type="text" @blur="isname(workerKindredName)" @ v-model="workerKindredName" placeholder="请填写紧急联系人姓名">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					联系电话
				</view>
				<view class="intext-in">
					<input type="text" maxlength="11"  @blur="isPhone(workerKindredPhone)" v-model="workerKindredPhone" placeholder="请填写紧急联系人电话">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					联系地址
				</view>
				<view class="intext-in">
					<input type="text" @blur="istrm(workerKindredAddress)" 
					v-model="workerKindredAddress" 
					placeholder="请填写紧急联系人联系地址">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					与劳动者关系
				</view>
				<view class="intext-in">
					<input type="text" @blur="istrm(workerKindredRelative)" v-model="workerKindredRelative" placeholder="请填写与劳动者关系">
				</view>
			</view>
		</view>
		<view class="title">劳动合同的类别，期限，试用期</view>
		<view class="contract-info-box">
			<view class="in-text" style="border: none;">
				<view class="itext-word" style="font-size: 14px; ">
					劳动合同期限
				</view>
			</view>
			<view class="xuanxangka">
				<view class="card" :class="contractWorkTimeType==0?'world-color card':'card'" @click="setcontractWorkTimeType(0)">工作量期限</view>
				<view class="card" :class="contractWorkTimeType==1?'world-color card':'card'" @click="setcontractWorkTimeType(1)">固定期限</view>
				<view class="card" :class="contractWorkTimeType==2?'world-color card':'card'" @click="setcontractWorkTimeType(2)">无固定期限</view>
			</view>
			<view class="picker-box" v-if="contractWorkTimeType==0">
				<view class="picker-list">
					<label class="picker-x" @clic>
						<picker mode="date"   @change="setcontractWorkStart($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkStart}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
						
					</label>
					<view class="">至</view>
					<label class="picker-x">
						<picker mode="date" :start="contractWorkStart"  @change="setcontractWorkEnd($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkEnd}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
					</label>
				</view>
				<view class="picker-list" style="width: 90%; justify-content: left; margin-top: 5px; margin-bottom: 5px;">
					试用期
				</view>
				<view class="picker-list">
					<label class="picker-x">
						<picker mode="date" :start="contractWorkStart"  @change="setcontractWorkTryStart($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkTryStart}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
					</label>
					<view class="">至</view>
					<label class="picker-x">
						<picker mode="date" :start="contractWorkTryStart"  :end="contractWorkEnd"  @change="setcontractWorkTryEnd($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkTryEnd}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
					</label>
				</view>
				<view style="width: 100%; height: 15rpx;"></view>
			</view>
			<view class="picker-box" v-if="contractWorkTimeType==1">
				<view class="picker-list">
					<label class="picker-x">
						<picker mode="date" :start="contractWorkStart" @change="setcontractWorkStart($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkStart}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
					</label>
					<view class="">至</view>
					<label class="picker-x">
						<picker mode="date" :start="contractWorkStart" @change="setcontractWorkEnd($event)">
							<view class="sanjiaoxing-box">
								<view style="color: #808080;">{{contractWorkEnd}}</view><image src="../../../static/images/sanjiaoxing.png"></image>
							</view>
						</picker>
					</label>
				</view>
				
				<view style="width: 100%; height: 15rpx;"></view>
			</view>
			<view style="width: 100%; height: 15rpx;"></view>
		</view>
		<view class="title">工作岗位，工作地点，工作内容和工作时间</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					工作岗位
				</view>
				<view class="intext-in">
					<picker mode="selector"  :range="workerType" @change="setworkeType($event)">
						<view style="color: #808080;">{{contractWorkType}}</view>
					</picker>
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					工作地点
				</view><!-- contractWorkAddress --><!-- "请选择工作地点" -->
				<!-- contractWorkAddress -->
					<view class="intext-in">
						<input type="text" v-model="contractWorkAddress" placeholder="请填写工作地址">
					</view>
				</view>
			<view class="in-text">
				<view class="itext-word">
					工作内容
				</view>
				<view class="intext-in">
					<input type="text" @blur="istrm(contractWorkContent)" v-model="contractWorkContent" placeholder="请填写工作内容">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					完成任务标准
				</view>
				<view class="intext-in">
					<input type="text" @blur="istrm(contractWorkStandard)" v-model="contractWorkStandard" placeholder="请填写完成任务标准">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					包工头
				</view><!-- contractWorkAddress --><!-- "请选择班组" -->
				<view class="intext-in">
					<picker mode="selector" :disabled="disClick" :range="contractorForemans" @change="setcontractorForeman($event)">
						<view style="color: #808080;">{{contractorForeman}}</view>
					</picker>
				</view>
			</view>
		</view>
		<view class="title">工资和支付方式</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					工资支付日期
				</view>
				<view class="intext-in">
					<picker mode="selector" :range="daymoney" @change="setcontractSalaryGetTime($event)">
						<view style="color: #808080;">{{contractSalaryGetTime}}</view>
					</picker>
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					选择支付工资基本方式
				</view>
			</view>
			<view class="xuanxangka" style="justify-content: space-around;">
				<view :class="contractSalaryType==0?'world-color card':'card'"><view class="icon">1</view><view @click="setcontractSalaryType(0)" >月基本工资</view></view>
				<view :class="contractSalaryType==1?'world-color card':'card'"><view class="icon">2</view><view @click="setcontractSalaryType(1)" >日基本工资</view></view>
				<view :class="contractSalaryType==2?'world-color card':'card'"><view class="icon">3</view><view @click="setcontractSalaryType(2)" >计件</view></view>
			</view>
			<view class="jiabantype-box" v-if="contractSalaryType==0">
				<view class="text-input-box-it">
					<input type="text" @blur="isNum(contractSalaryMonthBase)" v-model="contractSalaryMonthBase" placeholder="请输入月基本工资">
				</view>
<!-- 				<view class="text-box-jiaban">
					<view class="bgcolor-box">
						<input v-if="" type="text" @blur="isNum(contractSalaryMonthAdd)" v-model="contractSalaryMonthAdd" placeholder="请输入加班工资">
					</view>
					<text>每小时</text>
				</view> -->
			</view>
			<view class="jiabantype-box" v-if="contractSalaryType==1">
				<view class="text-input-box-it">
					<input type="text" @blur="isNum(contractSalaryDayBase)" v-model="contractSalaryDayBase" placeholder="请输入日基本工资">
				</view>
				<view class="text-box-jiaban">
					<view class="bgcolor-box">
						<input type="text" @blur="isNum(contractSalaryDayAdd)" v-model="contractSalaryDayAdd" placeholder="请输入加班工资">
					</view>
					<text>每小时</text>
				</view>
			</view>
			<view class="xuanxangbox" v-if="contractSalaryType==2">
				<view class="xuanxang">
					<picker class="picker-cs-box" mode="selector" :range="Workertypelist" @change="setworkertypeval($event)">
						<view class="sanjiaoxing-box">
							<view style="color: #808080;">{{workertypeval}}</view><image src="../../../static/images/sanjiaoxing.png"></image>  
						</view>   <!-- 类型 -->
					</picker>
				</view>
				<view class="xuanxang" v-if="contractSalaryType==2">
					<input type="text" @blur="isNum(contractSalaryNumberBase)" v-model="contractSalaryNumberBase" placeholder="请输入金额" style="text-align: center; font-size: 30rpx; color: black;">
				</view>
				<view class="xuanxang" v-show="contractSalaryType==2">
					<picker class="picker-cs-box" mode="selector" :range="jijianlist" @change="setjijianlistval($event)">
						<view class="sanjiaoxing-box" style="justify-content: center;">
							<view style="color: #808080;">{{jijianlistval}}</view><image src="../../../static/images/sanjiaoxing.png"></image>  
						</view>   <!-- 单位 -->
					</picker>
				</view>
			</view>
			<view class="in-text" style="margin-top: 20rpx;">
				<view class="itext-word">
					其他备注
				</view>
				<view class="intext-in">
					<input type="text" @blur="istrm(contractOtherRemark)" v-model="contractOtherRemark"  placeholder="请填写其他备注">
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					试用期工资
				</view>
				<view class="intext-in">
					<input type="text" @blur="isNum(workerTryBase)" v-model="workerTryBase" placeholder="请填写试用期工资">
				</view>
			</view>
		</view>
		<view class="title">其他</view>
		<view class="contract-info-box">
			<view class="in-text">
				<view class="itext-word">
					其他事项
				</view>
			</view>
			<view class="text-box">
				<textarea name="" id="" v-model="contractOtherThing" cols="30" rows="10" placeholder="请填写其他事项"></textarea>
				<view class="totalnum">{{contractOtherThing.length}}/140</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					合同及附件份数
				</view>
				<view class="intext-in">
					<picker mode="selector" :value="countindex" :range="count" @change="pickcount($event)">
						<view style="color: #808080;">{{contractNumber}}</view>
					</picker>
				</view>
			</view>
			<view class="in-text">
				<view class="itext-word">
					甲乙双方各执份数
				</view>
				<view class="intext-in">
					<picker mode="selector" :range="jycount" @change="pickjycount($event)">
						<view style="color: #808080;">{{contractOwnNumber}}</view>
					</picker>
				</view>
			</view>
		</view>
		<view class="made-contract">
			<button @click="madecontract()">生成合同</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				contractorForemans:['请先选择上方用人单位'],
				contractorForeman:'请选择包工头',
				isheader:'',
				unitid:'',
				unitIds:[],
				contractProjectName:'请选择项目',
				workerType:[],
				contractOrder:false,
				contractPersonyiimg:[],
				workeAdderss:[],
				daymoney:['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'],
				userId: null, //劳动者id 
                contractPersonjiaimg:[],
				unitcontractid:[],
				workerinfo:[],
				subconnect:[],
				subadress:[],
				subphone:[],
				subunitcode:[],
				subunitusername:[],
				subcontractingName:[],
				workertypeval:'请选择类型',
				Workertypeindex:0,
				Workertypelist:[],
				projectName:'',
				projectId:'',
				workmoney:['3000','4000','5000'],
				jijianlistval:'单位',
				jijianindex:0,
				jijianlist:[],
				jysum:0,
				jyindex:0,
				jycount:['1','2','3','4','5','6','7','8','9','10'],
				countindex:0,
				count:['1','2','3','4','5','6','7','8','9','10'],
				  cindex:0,
				  contractId: '',
				  contractNumber: "请选择份数",
				  contractOtherRemark: "",
				  contractOwnNumber: "请选择份数",
				  contractPersonOneImgOne: "",
				  contractPersonOneImgTwo: "",
				  contractPersonOneTime: new Date().toISOString().slice(0,10).toString(),
				  contractPersonTwoImgOne: "",
				  contractPersonTwoTime: "",
				  contractRelativeProjectId: 0,
				  contractSalaryDayAdd: "",
				  contractSalaryDayBase: "",
				  contractSalaryMonthAdd: "",
				  contractSalaryMonthBase: "",
				  contractSalaryNumberBase: "",
				  contractSalaryType: 0,
				  contractStatus: 0,
				  contractTryTime: "",
				  contractWorkAddress: "",
				  contractWorkContent: "",
				  contractWorkEnd: "请选择时间",
				  contractWorkStandard: "",
				  contractWorkStart: "请选择时间",
				  contractWorkTimeType: 0,
				  contractWorkTryEnd: "",
				  contractWorkTryStart: "",
				  contractWorkType: "请选择岗位",
				  id: 0,
				  isEffective: 0,
				  unitAddress: "",
				  unitContactAddress: "",
				  unitCreditCode: "",
				  unitName: "点击选择单位名称",
				  unitOwnPerson: "",
				  unitOwnPhone: "",
				  workerContactAddress: "",
				  workerIdentityCard: "",
				  workerKindredAddress: "",
				  workerKindredName: "",
				  workerKindredPhone: "",
				  workerKindredRelative: "",
				  workerName: "",
				  workerPhone: "",
				  workerSex: 0,
				  contractinfo:{},
				  contractSalaryGetTime:'请选择日期',
				  contractOtherThing:'',
				  workerTryBase:'',
				  contractType:1,//合同类型简单超时或者复杂
				  addressIsNull: false ,//项目账号登入没有地址
				  relativeProjectId:'',
				  relativeUnitId:'',
				  workeAdderssid:[],
				  disClick:false,
				  personIdentity: 10,
			}
		},
    created() {
      
    },
	onLoad(options) {
            console.log('options',options)
			this.projectName=uni.getStorageSync('projectName')
			this.projectId=uni.getStorageSync('projectId')
			this.contractId=this.uuid(8)//uuid生成合同编号
			this.getsubcontracting() // 获取用人单位信息
            this.userId = options.id//获取签约合同人的id
			this.getworkerinfo(parseInt(options.id)) // 获取劳动者信息
			this.getdanweiheleixing() // 获取工作岗位和工作量单位
			this.getworkeAdderss()//获取项目信息
			this.setcontractWorkTimeType(0)
	},
	methods: {
			setcontractorForeman(e){//修改获取包工头字段
				if(this.unitid==''){
					uni.showToast({
						title:'请先选择用人单位',
						icon:'none'
					})
					return
				}
				this.contractorForeman=this.contractorForemans[e.detail.value]
			
			},
			selectbaogontou(){//该方法查询包工头
				if(uni.getStorageSync('usertype')==3){//角色身份判断3为包工头
					this.contractorForeman=uni.getStorageSync('nickName')
					this.disClick=true
				}else if(uni.getStorageSync('usertype')==2&&this.personIdentity==1){//角色身份判断2为劳资项目personIdentity为签约人的身份判断1为劳工
					uni.$get(this.path+'/person/getContractorList/'+this.unitid).then(res=>{//查询包工头接口参数为单位id
						console.log('查询包工头',res);
						if(res.code==200){
							if(res.data.length==0){
								uni.showModal({
									title:'提示',
									content:'该劳工未与班组长签约，请联系其班组长进行签约',
									success: (res) => {
										if(res.confirm){
											console.log('用户点击了确定');
											uni.redirectTo({//返回选人页面
												url:'/pages/example/contract/contracter'
											})
										}else if(res.cancel){
											uni.redirectTo({//返回选人页面
												url:'/pages/example/contract/contracter'
											})
										}
										
									},
									
								})
							}
							this.contractorForemans=[]
							for(let i=0;i<res.data.length;i++){
								this.contractorForemans.push(res.data[i].personName)
							}
						}
					})
				}else{
					this.contractorForeman=this.workerName
					console.log('usertype',uni.getStorageSync('usertype')==2);
					this.disClick=true
				}
			},
			selectcontractorForeman(){//劳资项目添加关系
				uni.$post(this.path+'/person/addUnitContractorRelative',{
					unitId:this.unitid,
					specialId:this.userId,
					contractorId:uni.getStorageSync('workerId'),
					projectId:this.relativeProjectId
				}).then(res=>{
					uni.$post(this.path+'/contract/toPicture/1-1',{//生成复杂合同图片
							   contractId: this.contractId, //合同编号
							   contractNumber: this.contractNumber, //合同总份数
							   contractOtherRemark: this.contractOtherRemark, //合同其他备注
							   contractOwnNumber: this.contractOwnNumber, //甲乙双方各拥有合同份数
							   contractPersonOneImgOne: this.contractPersonOneImgOne, //甲方盖章图片(或者委托人)
							   contractPersonOneImgTwo: this.unitOwnPerson, //甲方法定代表人签印(或者委托人)
							   contractPersonOneTime: this.contractPersonOneTime, //甲方认证时间	
							   contractPersonTwoImgOne: '', 
							   contractPersonTwoTime: "",
							   contractRelativeProjectId:this.contractRelativeProjectId,//this.projectId此id需使用uni.getStorageSync('projectId')
							   contractSalaryDayAdd: this.contractSalaryDayAdd, //日加班工资（每小时）
							   contractSalaryDayBase: this.contractSalaryDayBase, //日基本工资
							   contractSalaryMonthAdd: this.contractSalaryMonthAdd, //月加班工资（每小时）
							   contractSalaryMonthBase: this.contractSalaryMonthBase, //月基本工资
							   contractSalaryNumberBase: this.contractSalaryNumberBase, //计件基本工资
							   contractSalaryType: this.contractSalaryType,
							   contractStatus: 2,
							   contractTryTime: this.contractTryTime,
							   contractWorkAddress: this.contractWorkAddress,
							   contractWorkContent: this.contractWorkContent,
							   contractWorkEnd: this.contractWorkEnd,
							   contractWorkStandard: this.contractWorkStandard,
							   contractWorkStart: this.contractWorkStart,
							   contractWorkTimeType: this.contractWorkTimeType,
							   contractWorkTryEnd: this.contractWorkTryEnd,
							   contractWorkTryStart: this.contractWorkTryStart,
							   contractWorkType: this.contractWorkType,
							   isEffective: 0,
							   unitAddress: this.unitAddress,
							   unitContactAddress: this.unitContactAddress,
							   unitCreditCode: this.unitCreditCode,
							   unitName: this.unitName,
							   unitOwnPerson: this.unitOwnPerson,
							   unitOwnPhone: this.unitOwnPhone,
							   workerContactAddress: this.workerContactAddress,
							   workerIdentityCard: this.workerIdentityCard,
							   workerKindredAddress: this.workerKindredAddress,
							   workerKindredName: this.workerKindredName,
							   workerKindredPhone: this.workerKindredPhone,
							   workerKindredRelative: this.workerKindredRelative,
							   workerName: this.workerName,
							   workerPhone: this.workerPhone,
							   workerSex:this.workerSex,
							   workGroup:this.contractorForeman,
						}).then(res=>{
							if(res.code==200){
								console.log('生成图片');
										if(res.code==200){
										uni.hideLoading()
										// uni.showToast({
										// title: '合同生成成功',
										// icon: 'none',
										// duration: 1500,
										// })
										setTimeout(() => {
										console.log('成功');
										this.$emit('contractimg',res.data)
										this.toccc(res.data)
										}, 500)
							}
					
							
							}
						})
				})
			},
			isPhone(phone){//电话号码字段校验
					 const regex = /^(13[0-9]|14[5-9]|15[0-35-9]|16[6]|17[0-8]|18[0-9]|19[89])\d{8}$/;
							// return this.unitOwnPhone.length == 11
							if(!regex.test(phone)  && phone.length!=''){
								uni.showToast({
									title:'请输入正确手机号',
									icon:'none',
									duration:1500
								})
								return 
							}
			},
			iscountNumber(str){//数字校验
			 const regex = /^(13[0-9]|14[5-9]|15[0-35-9]|16[6]|17[0-8]|18[0-9]|19[89])\d{8}$/;
			 if(!regex.test(str)){
			   this.workerPhone=''
			   return false
			 }
			 return true
			},
			isname(str){//名字字段校验
				if(!this.validateName(str)){
					uni.showToast({
						title:'请正确输入姓名',
						icon:'none',
						duration:1500
					})
					return 
				}
			},
			istrm(str){//空格校验
				if(this.isBlank(str) && str!=''){
					uni.showToast({
						title:'请不要输入空格',
						icon:'none',
						duration:1500
					})
					return 
				}else if(this.isSpecialChar(str)){
					uni.showToast({
						title:'请不要输入特殊字符',
						icon:'none',
						duration:1500
					})
					return 
				}else if(this.isNumber(str)){
					uni.showToast({
						title:'请不要输入数字',
						icon:'none',
						duration:1500
					})
					return 
				}
			},
			isNum(num){//数字校验
				if(this.isNumber(num)){
					return num=''
				}else{
					uni.showToast({
						title:'请输入数字',
						icon:'none',
						duration:1500
					})
				}
			},
			validateName(name) {
			   // 中文名正则表达式，限制长度为2-4个字符
			   const chineseNameRegex = /^[\u4e00-\u9fa5a-zA-Z\s]{2,4}$/;
			   // 英文名正则表达式，限制长度为2-10个字符
			   const englishNameRegex = /^[a-zA-Z\s]{2,10}$/;
			   return chineseNameRegex.test(name) || englishNameRegex.test(name);
			},
			checkName(name) {//姓名字段校验
			  // 正则表达式规则：2-4个汉字或字母
			  const reg = /^[\u4e00-\u9fa5a-zA-Z]{2,4}$/;
			  return reg.test(name);
			},
			isSpecialChar (input) {  //效验特殊字符
			 const specialCharRegex = /[!@#$%^&*(),.?":{}|<>]/;
			 return specialCharRegex.test(input); 
			 },
			isBlank(str) {//判断是否为空字符串
			  return str.trim().length === 0;
			},
			isChinese (input) { //效验是否为中文
				const chineseRegex = /^ [\u4e00-\u9fa5]+$/;
				return chineseRegex.test(input);
			}, // 使用示例 const input = "你好"; console.log(isChinese(input)); // true
			isNumber (input) { //数字校验
			 const numberRegex = /^[0-9]+$/;
			 return numberRegex.test(input); 
			}, // 使用示例 const input = "12345"; console.log(isNumber(input)); // true
			setcontractSalaryGetTime(e){//选择工资支付日期
				this.contractSalaryGetTime=this.daymoney[e.detail.value]
			},
			uuid(len, radix) {//uuid生成
			    var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
			    var uuid = [], i;
			    radix = radix || chars.length;
			 
			    if (len) {
			      // Compact form
			      for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
			    } else {
			      // rfc4122, version 4 form
			      var r;
			 
			      // rfc4122 requires these characters
			      uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
			      uuid[14] = '4';
			 
			      // Fill in random data.  At i==19 set the high bits of clock sequence as
			      // per rfc4122, sec. 4.1.5
			      for (i = 0; i < 36; i++) {
			        if (!uuid[i]) {
			          r = 0 | Math.random()*16;
			          uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
			        }
			      }
			    }
			 
			    return uuid.join('');
			},
			getworkeAdderss(){//获取项目信息
				uni.$post(this.path+'/project/queryAll',{
					  id: '0',
					  orderBy: "",
					  pageNo: 0,
					  pageSize: 0,
					  projectCreateUnit: "",
					  projectName: "",
					  returnFields: ""
				}).then(res=>{
					console.log('获取项目结果',res);
					if(res.code==200){
						for(let i=0;i<res.data.records.length;i++){
							this.workeAdderss.push(res.data.records[i].projectName)
						}
						console.log('workeAdderss',this.workeAdderss);
						if(this.workeAdderss.length==0){
							uni.showToast({
								title:'获取项目信息异常,返回首页中......',
								icon:'none',
								duration:1500
							})
							setTimeout(()=>{
								uni.switchTab({
									url:'../home/index'
								})
							},1500)
						}
					}else{
						uni.showToast({
							title:'项目信息获取失败,返回首页中......',
							icon:'none',
							duration:1000
						})
						setTimeout(()=>{
							uni.switchTab({
								url:'../home/index'
							})
						},1000)
					}
					
				})
			},
			getdanweiheleixing(){//获取字典如米，平方米，工作岗位，班组
				uni.$get(this.path+'system/dict/data/type/'+uni.getStorageSync('leixing')).then(res=>{
					if(res.code==200){
						for(let i=0;i<res.data.length;i++){
							this.Workertypelist.push(res.data[i].dictLabel)
						}
					}else{
						uni.showToast({
							title:'工作岗位信息获取失败,返回首页中......',
							icon:'none',
							duration:1000
						})
						setTimeout(()=>{
							uni.switchTab({
								url:'../home/index'
							})
						},1000)
					}
				})
				uni.$get(this.path+'system/dict/data/type/'+uni.getStorageSync('danwei')).then(res=>{
					if(res.code==200){
						for(let i=0;i<res.data.length;i++){
							this.jijianlist.push(res.data[i].dictLabel)
						}
					}else{
						uni.showToast({
							title:'单位类型获取失败,返回首页中......',
							icon:'none',
							duration:1000
						})
						setTimeout(()=>{
							uni.switchTab({
								url:'../home/index'
							})
						},1000)
					}
				})
				uni.$get(this.path+'system/dict/data/type/'+uni.getStorageSync('gangwei')).then(res=>{
					if(res.code==200){
						console.log('gangwei',res);
						for(let i=0;i<res.data.length;i++){
							this.workerType.push(res.data[i].dictLabel)
						}
					}else{
						uni.showToast({
							title:'单位类型获取失败,返回首页中......',
							icon:'none',
							duration:1000
						})
						setTimeout(()=>{
							uni.switchTab({
								url:'../home/index'
							})
						},1000)
					}
				})
			},
			// 获取劳动者信息
			getworkerinfo(id){
                 console.log('获取劳动者信息')
				uni.$get(this.path + '/person/get/' + id).then(res=>{
				console.log('获取劳动者信息 result',res);
					if(res.code==200){
						this.workerName=res.data.personName
						this.workerSex=res.data.personSex
						this.workerIdentityCard=res.data.personIdentityCard
						this.workerPhone=res.data.personPhone
						this.workerContactAddress=res.data.personAddress//——————————————————————地址绑定？————————————————————
						this.addressIsNull = (res.data.personAddress == null ? false : true)
						this.personIdentity = res.data.personIdentity
						console.log('personIdentity',this.personIdentity);
						 // 没有地址进来就允许输入
					}else{
						uni.showToast({
							title:'获取不了劳动者信息，请重试',
							icon:'none',
							duration:1500
						})
						setTimeout(()=>{
							uni.redirectTo({
								url:'./contracter'
							})
						},1500)
					}
				})
			},
			setworkeAdderss(e){//获取项目信息
				this.contractProjectName=this.workeAdderss[e.detail.value]
				this.relativeProjectId=this.workeAdderssid[e.detail.value]
				this.contractOrder=true
			},
			setsubcontracting(e){//选择用人单位
			if(this.contractOrder==false){
			 uni.showToast({
			 	title:'请先选择上方的项目',
				icon:'none',
				duration:1000
			 })
			 setTimeout(()=>{},1000)
			 return
			}
                this.contractPersonOneImgOne=this.contractPersonjiaimg[e.detail.value]
				this.unitName=this.subcontractingName[e.detail.value]
				this.unitCreditCode=this.subunitcode[e.detail.value]
				this.unitOwnPerson=this.subunitusername[e.detail.value]
				this.unitOwnPhone=this.subphone[e.detail.value]
				this.unitAddress=this.subadress[e.detail.value]//——————————————————————地址绑定？————————————————————
				this.unitContactAddress=this.subconnect[e.detail.value]
				this.contractRelativeProjectId=this.unitcontractid[e.detail.value]
				this.relativeUnitId=this.unitcontractid[e.detail.value]
				this.selectbaogontou()//查询包工头
			},
			getsubcontracting(){//查询用人单位
				uni.$post(this.path+'/unit/queryAll',{
					 pageNo: 1,
					 pageSize: 100000,
					 unitFlag: 0
				}).then(res=>{
					console.log('获取用人单位信息',res);
					if(res.code==200){
						for(let i=0;i<res.data.records.length;i++){
                            this.contractPersonjiaimg.push(res.data.records[i].unitPromiseImgTwo)
							this.unitcontractid.push(parseInt(res.data.records[i].id))
							this.subcontractingName.push(res.data.records[i].unitName)
							this.subunitusername.push(res.data.records[i].unitOwnName)
							this.subunitcode.push(res.data.records[i].unitCreditCode)
							this.subphone.push(res.data.records[i].unitOwnPhone)
							this.subadress.push(res.data.records[i].unitWhere)//——————————————————————地址绑定？————————————————————
							this.subconnect.push(res.data.records[i].unitWorkWhere)
						}
						// console.log('单位名称',this.subcontractingName);
						// console.log('社会信用代码',this.subunitcode);
						// console.log('负责人名',this.subunitusername);
						// console.log('电话',this.subphone);
						// console.log('住所',this.subadress);
						// console.log('联系地址',this.subconnect);
						// console.log('项目id',this.unitcontractid);
						console.log('盖章图片',this.contractPersonjiaimg);
					}else{
						uni.showToast({
							title:'获取不了用人单位信息，请先添加单位，或重试',
							icon:'none',
							duration:1500
						})
						setTimeout(()=>{
							uni.redirectTo({
								url:'./contracter'
							})
						},1500)
					}
				})
			},
			setworkeType(e){
				this.contractWorkType=this.workerType[e.detail.value]
			},
			setsex(e){//选择性别
				this.workerSex=e.detail.value;
				console.log(this.workerSex);
				
			},
			setworkertypeval(e){//选择工作岗位
				this.workertypeval=this.Workertypelist[e.detail.value]
				
			},
		
			setjijianlistval(e){//选择计件岗位
				this.jijianlistval=this.jijianlist[e.detail.value]
			},
			setcontractSalaryType(num){//选择工资发放类型
				this.contractSalaryType=num
			},
			setcontractWorkEnd(e){//选择合同结束时间
				this.contractWorkEnd=e.detail.value
				this.contractWorkEnd=this.contractWorkEnd.toString()
				console.log(this.contractWorkEnd);
			},
			setcontractWorkStart(e){//选择合同开始时间
				this.contractWorkStart=e.detail.value
				this.contractWorkStart=this.contractWorkStart.toString()
				console.log(this.contractWorkStart);
				
			},
			setcontractWorkTryEnd(e){//选择合同试用结束时间
				this.contractWorkTryEnd=e.detail.value
				this.contractWorkTryEnd=this.contractWorkTryEnd.toString()
				console.log(this.contractWorkTryEnd);
				
			},
			setcontractWorkTryStart(e){//选择合同试用开始时间
				this.contractWorkTryStart=e.detail.value
				this.contractWorkTryStart=this.contractWorkTryStart.toString()
				console.log(this.contractWorkTryStart);
			},
			setcontractWorkTimeType(num){//该方法选择合同时间，并把其它不选择时间设为空串
				this.contractWorkTimeType=num
				if(num==2){//固定期限日期
					this.contractWorkTryStart=''
					this.contractWorkTryEnd=''
					this.contractWorkEnd='请选择时间'
					this.contractWorkStart=new Date().toISOString().slice(0,10).toString()
					console.log('固定期限日期',this.contractWorkStart);
				}else if(num==0){
					this.contractWorkTryEnd='请选择时间'
					this.contractWorkTryStart='请选择时间'
				}else{
					this.contractWorkTryStart=''
					this.contractWorkTryEnd=''
				}
			},
			pickjycount(e){//甲乙双方持有份数
				this.jyindex=e.detail.value
				this.contractOwnNumber=this.count[this.jyindex]
				
			},
			pickcount(e){//合同总份数
				this.countindex=e.detail.value
				this.contractNumber=this.count[this.countindex]
				
			},
			tomade(id){//合同模板跳转
				uni.navigateTo({
					url:'./contractmodel?id='+id
				})
			},
			toccc(id){//生成合同并跳转
				uni.redirectTo({
					url:'./contracted/contracted?id='+id
				})
			},
			getMonthDifference(date1, date2) {//日期相减得到月数
			  // 将日期转换为毫秒数
			  const date1Milliseconds = date1.getTime();
			  const date2Milliseconds = date2.getTime();
			
			  // 计算相差的毫秒数
			  const differenceMilliseconds = Math.abs(date1Milliseconds - date2Milliseconds);
			
			  // 将相差的毫秒数转换为月数
			  const differenceMonths = differenceMilliseconds / (1000 * 60 * 60 * 24 * 30);
			
			  return differenceMonths;
			},
			madecontract(){//该方法上传合同信息并生成合同图片预览
				console.log('--------点击了生成');
				if(this.workerKindredName.length==0 && !this.validateName(this.workerKindredName)){
					uni.showToast({
						title:'请正确填写紧急联系人姓名',
						icon:'none',
						duration:1500
					})
					return
				}else if(!this.isNumber(this.workerKindredPhone) && this.workerKindredPhone.length!=11 ){
					uni.showToast({
						title:'请正确填写紧急联系人电话,检查是否填写或长度是否为11位',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.workerKindredAddress.length==0){
					uni.showToast({
						title:'请填写紧急联系人地址',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.workerKindredRelative.length==0){
					uni.showToast({
						title:'请填写劳动者关系',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkStart=='请选择时间'&&this.contractWorkTimeType==0){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkEnd=='请选择时间'&&this.contractWorkTimeType==0){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkStart=='请选择时间'&&this.contractWorkTimeType==1){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkEnd=='请选择时间'&&this.contractWorkTimeType==1){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkTryStart=='请选择时间'&&this.contractWorkTimeType==0){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkTryEnd=='请选择时间'&&this.contractWorkTimeType==0){
					uni.showToast({
						title:'请选择时间',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkType.length==0&&this.contractWorkType=='请选择岗位'){
					uni.showToast({
						title:'请选择工作岗位',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkAddress.length==0){
					uni.showToast({
						title:'请填写工作地点',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkContent.length==0){
					uni.showToast({
						title:'请填写工作内容',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractWorkStandard.length==0){
					uni.showToast({
						title:'请填写工作完成标准',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractSalaryGetTime=='请选择日期'){
					uni.showToast({
						title:'请选择工资发放日期',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractSalaryMonthBase.length==0&&this.contractSalaryType==0){
					uni.showToast({
						title:'请填写月基本工资',
						icon:'none',
						duration:1500
					})
					return
				}
				// else if(this.contractSalaryMonthAdd.length==0&&this.contractSalaryType==0){
				// 	// uni.showToast({
				// 	// 	title:'填写月加班工资',
				// 	// 	icon:'none',
				// 	// 	duration:1500
				// 	// })
				// 	// return
				// }
				else if(this.contractSalaryDayBase.length==0&&this.contractSalaryType==1){
					uni.showToast({
						title:'填写日基本工资',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractSalaryDayAdd.length==0&&this.contractSalaryType==1){
					uni.showToast({
						title:'填写日加班工资',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractSalaryNumberBase.length==0&&this.contractSalaryType==2){
					uni.showToast({
						title:'填输入金额',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.unitName=='点击选择单位名称'){
					uni.showToast({
						title:'填选择单位名称',
						icon:'none',
						duration:1500
					})
					return
				}
				// else if(this.contractWorkAddress=='请填写工作地点'){
				// 	uni.showToast({
				// 		title:'请填写工作地点',
				// 		icon:'none',
				// 		duration:1500
				// 	})
				// 	return
				// }
				else if(this.workerPhone.length==0){
					uni.showToast({
						title:'请填写劳动者电话号码',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractNumber.indexOf('请选择份数')!=-1){
					uni.showToast({
						title:'请选择合同及附件总份数',
						icon:'none',
						duration:1500
					})
					return
				}else if(this.contractOwnNumber.indexOf('请选择份数')!=-1){
					uni.showToast({
						title:'请选择甲乙合双方持有份数',
						icon:'none',
						duration:1500
					})
					return
				}
				if(this.contractWorkTimeType==1){
					this.contractWorkStart+=' 00:00:00'
					this.contractWorkTryStart=''
					this.contractWorkTryEnd=''
				}else if(this.contractWorkTimeType==2){
					this.contractWorkTryStart=''
					this.contractWorkTryEnd=''
					this.contractWorkEnd=''
				}else if(this.contractWorkTimeType==1){
					
				}
				if(this.contractSalaryType==0){
					this.contractSalaryDayBase=''
					this.contractSalaryDayAdd=''
					this.contractSalaryNumberBase=''
				}else if(this.contractSalaryType==1){
					this.contractSalaryMonthAdd=''
					this.contractSalaryMonthBase=''
					this.contractSalaryNumberBase=''
				}else{
					this.contractSalaryDayBase=''
					this.contractSalaryDayAdd=''
					this.contractSalaryMonthAdd=''
					this.contractSalaryMonthBase=''
				}
				if(this.contractWorkTryStart!=''&&this.contractWorkTryEnd!=''){//计算合同试用时间单位月
					this.contractTryTime=this.getMonthDifference(new Date(this.contractWorkTryStart),new Date(this.contractWorkTryEnd))
				}
        uni.showLoading({
          title: '合同生成中',
        })
				uni.$put(this.path+'/contract/add',{//上传添加合同信息
					contractId: this.contractId, //合同编号
					contractNumber: this.contractNumber, //合同总份数
					contractOtherRemark: this.contractOtherRemark, //合同其他备注
					contractOwnNumber: this.contractOwnNumber, //甲乙双方各拥有合同份数
					contractPersonOneImgOne: this.contractPersonOneImgOne, //甲方盖章图片(或者委托人)
					contractPersonOneImgTwo: this.unitOwnPerson, //甲方法定代表人签印(或者委托人)
					contractPersonOneTime: this.contractPersonOneTime, //甲方认证时间	
					contractPersonTwoImgOne: '', 
					contractPersonTwoTime: "",
					contractRelativeProjectId:this.contractRelativeProjectId,//this.projectId此id需使用uni.getStorageSync('projectId')
					contractSalaryDayAdd: this.contractSalaryDayAdd, //日加班工资（每小时）
					contractSalaryDayBase: this.contractSalaryDayBase, //日基本工资
					contractSalaryMonthAdd: this.contractSalaryMonthAdd, //月加班工资（每小时）
					contractSalaryMonthBase: this.contractSalaryMonthBase, //月基本工资
					contractSalaryNumberBase: this.contractSalaryNumberBase, //计件基本工资
					contractSalaryType: this.contractSalaryType,
					contractStatus: 2,
					contractTryTime: this.contractTryTime,  //单位月
					contractWorkAddress: this.contractWorkAddress,
					contractWorkContent: this.contractWorkContent,
					contractWorkEnd: this.contractWorkEnd,
					contractWorkStandard: this.contractWorkStandard,
					contractWorkStart: this.contractWorkStart,
					contractWorkTimeType: this.contractWorkTimeType,
					contractWorkTryEnd: this.contractWorkTryEnd,
					contractWorkTryStart: this.contractWorkTryStart,
					contractWorkType: this.contractWorkType,
					isEffective: 0,
					unitAddress: this.unitAddress,
					unitContactAddress: this.unitContactAddress,
					unitCreditCode: this.unitCreditCode,
					unitName: this.unitName,
					unitOwnPerson: this.unitOwnPerson,
					unitOwnPhone: this.unitOwnPhone,
					workerContactAddress: this.workerContactAddress,
					workerIdentityCard: this.workerIdentityCard,
					workerKindredAddress: this.workerKindredAddress,
					workerKindredName: this.workerKindredName,
					workerKindredPhone: this.workerKindredPhone,
					workerKindredRelative: this.workerKindredRelative,
					workerName: this.workerName,
					workerPhone: this.workerPhone,
					workerSex:this.workerSex,
					contractType:this.contractType,
					workGroup:this.contractorForeman,
					projectName:this.contractProjectName,
					relativeProjectId:this.relativeProjectId,
					relativeUnitId:this.relativeUnitId
				}).then(res=>{
					if(res.code==200){
						console.log('新增合同成功');
						//  5劳资专员-个人 4劳工 3包工头 2劳资专员-项目 1管理员
						console.log('usertype',uni.getStorageSync('usertype'));
						if(uni.getStorageSync('usertype')==2){
							this.selectcontractorForeman()//添加劳资与包工头或劳工关系
							return
						}
						uni.$post(this.path+'/person/addUnitWorkerRelative',{//添加劳工与包工头关系
							unitId:this.unitid,
							workerId:this.userId,
							contractorId:uni.getStorageSync('workerId'),
							projectId:this.relativeProjectId
						}).then(res=>{
							uni.$post(this.path+'/contract/toPicture/1-1',{
									   contractId: this.contractId, //合同编号
									   contractNumber: this.contractNumber, //合同总份数
									   contractOtherRemark: this.contractOtherRemark, //合同其他备注
									   contractOwnNumber: this.contractOwnNumber, //甲乙双方各拥有合同份数
									   contractPersonOneImgOne: this.contractPersonOneImgOne, //甲方盖章图片(或者委托人)
									   contractPersonOneImgTwo: this.unitOwnPerson, //甲方法定代表人签印(或者委托人)
									   contractPersonOneTime: this.contractPersonOneTime, //甲方认证时间	
									   contractPersonTwoImgOne: '', 
									   contractPersonTwoTime: "",
									   contractRelativeProjectId:this.contractRelativeProjectId,//this.projectId此id需使用uni.getStorageSync('projectId')
									   contractSalaryDayAdd: this.contractSalaryDayAdd, //日加班工资（每小时）
									   contractSalaryDayBase: this.contractSalaryDayBase, //日基本工资
									   contractSalaryMonthAdd: this.contractSalaryMonthAdd, //月加班工资（每小时）
									   contractSalaryMonthBase: this.contractSalaryMonthBase, //月基本工资
									   contractSalaryNumberBase: this.contractSalaryNumberBase, //计件基本工资
									   contractSalaryType: this.contractSalaryType,
									   contractStatus: 2,
									   contractTryTime: this.contractTryTime,
									   contractWorkAddress: this.contractWorkAddress,
									   contractWorkContent: this.contractWorkContent,
									   contractWorkEnd: this.contractWorkEnd,
									   contractWorkStandard: this.contractWorkStandard,
									   contractWorkStart: this.contractWorkStart,
									   contractWorkTimeType: this.contractWorkTimeType,
									   contractWorkTryEnd: this.contractWorkTryEnd,
									   contractWorkTryStart: this.contractWorkTryStart,
									   contractWorkType: this.contractWorkType,
									   isEffective: 0,
									   unitAddress: this.unitAddress,
									   unitContactAddress: this.unitContactAddress,
									   unitCreditCode: this.unitCreditCode,
									   unitName: this.unitName,
									   unitOwnPerson: this.unitOwnPerson,
									   unitOwnPhone: this.unitOwnPhone,
									   workerContactAddress: this.workerContactAddress,
									   workerIdentityCard: this.workerIdentityCard,
									   workerKindredAddress: this.workerKindredAddress,
									   workerKindredName: this.workerKindredName,
									   workerKindredPhone: this.workerKindredPhone,
									   workerKindredRelative: this.workerKindredRelative,
									   workerName: this.workerName,
									   workerPhone: this.workerPhone,
									   workerSex:this.workerSex,
									   workGroup:this.contractorForeman,
								}).then(res=>{
									if(res.code==200){
										console.log('生成图片');
												if(res.code==200){
												uni.hideLoading()
												// uni.showToast({
												// title: '合同生成成功',
												// icon: 'none',
												// duration: 1500,
												// })
												setTimeout(() => {
												console.log('成功');
												this.$emit('contractimg',res.data)
												this.toccc(res.data)
												}, 500)
									}
							
									
									}
								})
						})
					}
					else{    
						console.log('生成合同的code不为200', res);
						uni.hideLoading()
						uni.showToast({
						title: '合同生成失败'+res.message,
						icon: 'none',
						duration: 1500,
						})
						setTimeout(()=>{
							uni.redirectTo({
								url:'./contracter'
							})
						},1500)
						return
            // setTimeout(() => {
            //   uni.navigateBack()
            // }, 1000)
						}
					})
			
			}
		}
	}
</script>



<style lang="scss" scoped>
	.picker-cs-box{
		width: 100%;
		display: flex;
		justify-content: right;
		align-items: center;
		font-size: 28rpx;
		.sanjiaoxing-box{
			width: 100%;
			padding-right: 10rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			view{
				width: fit-content;
				min-width: 150rpx;
			}
			image{
			width: 25rpx;
			height: 25rpx;
			// transform: rotate(180deg);
		}
		}
	}
  .made-contract{
	margin-top: 40rpx;
    width: 100%;
    height: 200rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    button{
      width: 80%;
      height: 35px;
      line-height: 35px;
      color: white;
      font-size: 14px;
      background-color: #2f67ff;
    }
  }
  .contract-number{
    width: 90%;
    margin: 0 auto;
    height: 30px;
    font-size: 12px;
    color: #bfbfbf;
    line-height: 30px;
  }
  .title{
    width: 95%;
    margin: 0 auto;
    margin-top: 5px;
    height: 20px;
    line-height: 20px;
    font-size: 15px;
    border-left: 4px solid #2f67ff;
    padding-left: 0.855%;
    box-sizing: border-box;
  }
  .contract-info-box{
    border-radius: 8px;
    background-color: white;
    margin: 0 auto;
    margin-top: 10px;
    width: 95%;
    .xuanxangka{
      width: 90%;
      margin: 0 auto;
      height: 25px;
      display: flex;
      align-items: center;
      .card{
        width: 35%;
        height: 100%;
        text-align: center;
        line-height: 25px;
        font-size: 14px;
        display: flex;
        justify-content: center;
        align-items: center;
        .icon{
          width: 15px;
          height: 15px;
          line-height: 15px;
          text-align: center;
          border-radius: 50%;
          border: 1px solid #bfbfbf;
          color: #bfbfbf;
          font-size: 10;
        }
      }
    }
    .picker-box{
      width: 95%;
      // min-height: 120px;
      height: fit-content;
      background-color:#f6f6f6;
      margin: 0 auto;
      margin-top: 10px;
      margin-bottom: 10px;
      padding-top: 10px;
      .picker-list{
        width: 95%;
        margin: 0 auto;
        display: flex;
        justify-content: space-around;
        align-items: center;
        font-size: 14px;
        .picker-x{
          padding: 5px;
          width: 35%;
          height: 25px;
          background-color: white;
          display: flex;
          justify-content: space-between;
          align-items: center;
          picker{
            width: 100%;
            display: flex;
            align-items: center;
            .sanjiaoxing-box{
              width: 100%;
              display: flex;
              align-items: center;
              justify-content: space-between;
              image{
              margin-left: 40rpx;
              width: 25rpx;
              height: 25rpx;
              // transform: rotate(180deg);
            }
            
          }
          }
          
        }
      }
    }
    .in-text{
      display: flex;
      width: 95%;
      height: 35px;
      margin: 0 auto;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      border-bottom: #f6f9fc 1px solid;
      .itext-word{
        width: fit-content;
      }
      .intext-in{
        width: 60%;
        picker{
          float: right;
        }
        .bianxin{
          transform: scale(0.8);
          font-size: 13px;
          float: right;
          width: 200rpx;
          display: flex;
          justify-content: space-between;
        }
        input{
          width: 100%;
          font-size: 13px;
          text-align: right;
        }
      }
      
    }
    .jiabantype-box{
      width: 95%;
      margin: 0 auto;
      margin-top: 25rpx;
      height: fit-content;
      border-bottom: #f6f9fc 1px solid;
      .text-input-box-it{
        display: flex;
        align-items: center;
        min-height: 80rpx;
        background-color: #f6f6f6;
        height: fit-content;
        width: 90%;
        margin: 0 auto;
        input{
          font-size: 30rpx;
          width: 95%;
        }
      }
      .text-box-jiaban{
        in-height: 80rpx;
        height: fit-content;
        width: 90%;
        margin: 0 auto;
        margin-top: 15rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 80rpx;
        .bgcolor-box{
          display: flex;
          align-items: center;
          height: 80rpx;
          width: calc(100% - 100rpx);
          background-color: #f6f6f6;
          input{
            height: 100%;
            font-size: 30rpx;
            width: 100%;
            
          }
        }
        text{
          text-align: right;
          width: 100rpx;
          font-size: 30rpx;
          color: #bfbfbf;
        }
      }
    }
    .xuanxangbox{
      width: 95%;
      margin: 0 auto;
      height: 80px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      border-bottom: #f6f9fc 1px solid;
      .xuanxang{
        width: 30%;
        height: 50px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 12px;
        background-color: #f6f6f6;
        color: #bfbfbf;
      }
      .text-input-box{
        display: flex;
        align-items: center;
        min-height: 80rpx;
        background-color: #f6f6f6;
        height: fit-content;
        width: 90%;
        margin: 0 auto;
        input{
          font-size: 30rpx;
          width: 95%;
        }
      }
    }
    .text-box{
      width: 95%;
      margin: 0 auto;
      height: 120px;
      textarea{
        width: 100%;
        height: 100px;
        background: #f6f6f6;
        font-size: 14px;
      }
      .totalnum{
        background: #f6f6f6;
        width: 100%;
        text-align: right;
        font-size: 12px;
        color: #bfbfbf;
      }
    }
  }
  .world-color{
    color: #2f67ff;
    .icon{
      border-color: #2f67ff !important;
      color: #2f67ff !important;
    }
  }
</style>
